/**
 * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
 */
package com.jeeplus.modules.fee.service;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.jeeplus.core.persistence.Page;
import com.jeeplus.core.service.CrudService;
import com.jeeplus.modules.fee.entity.PayInvoice;
import com.jeeplus.modules.fee.mapper.PayInvoiceMapper;

/**
 * 应收发票Service
 * @author weisong
 * @version 2017-09-19
 */
@Service
@Transactional(readOnly = true)
public class PayInvoiceService extends CrudService<PayInvoiceMapper, PayInvoice> {

	public PayInvoice get(String id) {
		return super.get(id);
	}
	
	public List<PayInvoice> findList(PayInvoice payInvoice) {
		return super.findList(payInvoice);
	}
	
	public Page<PayInvoice> findPage(Page<PayInvoice> page, PayInvoice payInvoice) {
		return super.findPage(page, payInvoice);
	}
	
	@Transactional(readOnly = false)
	public void save(PayInvoice payInvoice) {
		super.save(payInvoice);
	}
	
	@Transactional(readOnly = false)
	public void delete(PayInvoice payInvoice) {
		super.delete(payInvoice);
	}

	// 更新核销金额和状态
	@Transactional(readOnly = false)
	public int updateVcaMoneyAndStatusById(Double vcaMoney, Integer status, String id) {
		return mapper.updateVcaMoneyAndStatusById(vcaMoney, status, id);
	}

	// 查询最大的单号和日期【用来生成单号】
	public PayInvoice findInvoiceNoAndInvoiceDate() {
		return mapper.findInvoiceNoAndInvoiceDate();
	}

	//根据发票子表查询发票主表
	public List<PayInvoice> findPayInvoiceByInvoiceDetail(String id){
		return mapper.findPayInvoiceByInvoiceDetail(id);
	}
}